{% extends "draw_base.html" %}
{% load humanize static debate_tags i18n %}

{% block page-alerts %}
  <div class="mb-3">
    {% include "draw_alerts_teams.html" %}
  </div>
{% endblock %}

{% block content %}

  <div class="row mb-4">

    <div class="col">
      <div class="card">

        <div class="card-body">
          <h5 class="card-title mb-0">{% trans "Adjudicator Allocations" %}</h5>
        </div>

        <div class="list-group list-group-flush">
          {% with no_chair=round.num_debates_without_chair even_panel=round.num_debates_with_even_panel %}

            {% if active_adjs < debates_in_round %}

              {% trans "There are currently fewer adjudicators checked in than there are rooms." as message %}
              {% include "components/item-info.html" with nopad=True type="danger" text=message %}

            {% else %}

              {% include "draw_alerts_adjudicators.html" %}

            {% endif %} {# active_adjs < debates_in_round #}

            {% roundurl 'edit-debate-adjudicators' as url %}
            {% if active_adjs < debates_in_round or no_chair > 0 or round.ballots_per_debate == 'per-adj' and even_panel > 0 %}
              {% trans "Allocate adjudicators" as title %}
              {% include "components/item-action.html" with text=title type="success" to_complete=True %}
            {% else %}
              {% trans "Edit adjudicator allocation" as title %}
              {% include "components/item-action.html" with text=title type="primary" %}
            {% endif %}

          {% endwith %}
        </div>

      </div>
    </div>

    <div class="col mt-md-0 mt-3">
      <div class="card">

        <div class="card-body">
          <h5 class="card-title mb-0">{% trans "Room Allocations" %}</h5>
        </div>
        <div class="list-group list-group-flush">

          {% include "draw_alerts_venues.html" %}

          {% roundurl 'edit-debate-venues' round as url %}
          {% if round.num_debates_without_venue > 0 %}
            {% trans "Allocate rooms" as title %}
            {% include "components/item-action.html" with text=title type="success" to_complete=True %}
          {% else %}
            {% trans "Edit room allocation" as title %}
            {% include "components/item-action.html" with text=title type="primary" %}
          {% endif %}

        </div>

      </div>
    </div>

    <div class="col mt-md-0 mt-3">
      <div class="card">

        <div class="card-body">
          <h5 class="card-title mb-0">{% trans "Preformed Panels" %}</h5>
        </div>

        <div class="list-group list-group-flush">

          {% if preformed_panels_in_round > 0 %}
            {% blocktrans trimmed asvar message count npanels=preformed_panels_in_round %}
              There is {{ npanels }} preformed panel available for this round.
            {% plural %}
              There are {{ npanels }} preformed panels available for this round.
            {% endblocktrans %}
            {% include "components/item-info.html" with nopad=True type="info" text=message %}
          {% else %}
            {% trans "There are no preformed panels available for this round" as message %}
            {% include "components/item-info.html" with nopad=True type="secondary" text=message %}
          {% endif %}

          {% roundurl 'edit-panel-adjudicators' as url %}
          {% blocktrans trimmed asvar text with round=round.abbreviation %}
            Edit preformed panels for {{ round }}
          {% endblocktrans %}
          {% include "components/item-action.html" with text=text type="primary" %}

          {% if round.next %}
            {% roundurl 'edit-panel-adjudicators' round.next as url %}
            {% blocktrans trimmed asvar text with round=round.next.abbreviation %}
              Edit preformed panels for {{ round }}
            {% endblocktrans %}
            {% include "components/item-action.html" with text=text type="primary" %}
          {% endif %}

        </div>

      </div>
    </div>

    {% with sides_unconfirmed=round.num_debates_with_sides_unconfirmed %}
      {% if sides_unconfirmed > 0 and pref.draw_side_allocations != 'manual-ballot' %}
        <div class="col mt-md-0 mt-3">
          <div class="card">

            <div class="card-body">
              <h5 class="card-title mb-0">{% trans "Side Allocations" %}</h5>
            </div>

            <div class="list-group list-group-flush">

              {% blocktrans trimmed asvar text count ndebates=sides_unconfirmed %}
                1 debate does not have its sides confirmed.
              {% plural %}
                {{ ndebates }} debates do not have their sides confirmed.
              {% endblocktrans %}
              {% include "components/item-info.html" with  nopad=True type="danger" %}

              {% roundurl 'edit-debate-teams' as url %}
              {% include "components/item-action.html" with text="Allocate Sides" type="success" to_complete=True %}

            </div>

          </div>
        </div>
      {% endif %}
    {% endwith %}

  </div>

  {{ block.super }}

{% endblock %}
